import java.util.*;
public class BiteDay45 {
    public int MoreThanHalfNum_Solution (int[] numbers) {
        // write code here
        int ans = numbers[0];
        int cnt = 0;
        for(int e : numbers){
            if(e == ans){
                cnt++;
            }else{
                cnt--;
                if(cnt==0){
                    ans = e;
                    cnt++;
                }
            }
        }
        return ans;
    }


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        HashMap<String, Integer> hashMap = new HashMap<>();
        List<String> list = new ArrayList<>();
        while(sc.hasNext()){
            String str = sc.nextLine();
            char[] arr = str.toCharArray();
            int i = 0;
            for(i = arr.length - 1; i >= 0; i--){
                if(arr[i]=='\\'){
                    break;
                }
            }
            String s = str.substring(i+1);
            if(hashMap.get(s)==null){
                list.add(s);
            }
            hashMap.put(s, hashMap.getOrDefault(s, 0)+1);
        }
        int sz = list.size();
        if(sz < 8){
            for(int i =0; i < sz; i++){
                String s = list.get(i);
                int j = 0;
                for(j = 0; j < s.length(); j++){
                    if(s.charAt(j)==' '){
                        break;
                    }
                }
                String ans = null;
                if(j >= 17){
                    ans = s.substring(j-17+1,j);
                }else{
                    ans = s.substring(0,j);
                }
                String num = s.substring(j+1,j+4);
                int cnt = hashMap.get(s);
                System.out.println(ans + " " + num + " " +cnt);
            }
        }else{
            for(int i = sz - 8; i < sz; i++){
                //查看空格前面有多少个字符

                String s = list.get(i);
                int j = 0;
                for(j = 0; j < s.length(); j++){
                    if(s.charAt(j)==' '){
                        break;
                    }
                }
                String ans = null;
                if(j >= 17){
                    ans = s.substring(j-17-1,j);
                }else{
                    ans = s.substring(0,j);
                }
                String num = s.substring(j+1,j+4);
                int cnt = hashMap.get(s);
                System.out.println(ans + " " + num + " " +cnt);
        }

        }
    }
}
